Skip to content

Use shared constant for hours per year#764

Open
Alb3e3 wants to merge 1 commit into
PyPSA:masterfrom
Alb3e3:use-hours-per-year-constant
Open

Use shared constant for hours per year#764
Alb3e3 wants to merge 1 commit into
PyPSA:masterfrom
Alb3e3:use-hours-per-year-constant

Conversation

@Alb3e3

@Alb3e3 Alb3e3 commented Jun 11, 2026

Copy link
Copy Markdown

Summary

  • add HOURS_PER_YEAR to the shared workflow constants
  • replace bare 8760/8760.0 year-hour literals in workflow scripts and rules
  • add a static regression test to prevent reintroducing bare year-hour literals

Closes #763.

Verification

  • python3 -m py_compile workflow/scripts/constants.py workflow/scripts/eulp.py workflow/scripts/add_extra_components.py workflow/scripts/_helpers.py workflow/scripts/prepare_network.py workflow/scripts/solve_network.py workflow/scripts/build_demand.py workflow/scripts/build_cost_data.py workflow/scripts/test/test_constants.py
  • uvx ruff check workflow/scripts/constants.py workflow/scripts/eulp.py workflow/scripts/add_extra_components.py workflow/scripts/_helpers.py workflow/scripts/prepare_network.py workflow/scripts/solve_network.py workflow/scripts/build_demand.py workflow/scripts/build_cost_data.py workflow/scripts/test/test_constants.py
  • uvx --from pytest pytest --noconftest workflow/scripts/test/test_constants.py -q

Note: I attempted the project-managed pytest run with uv run --extra dev pytest workflow/scripts/test/test_constants.py -q, but local dependency sync failed while building datrie==0.8.2 from Snakemake on this machine before tests could start. The isolated static test above avoids the heavyweight model dependencies and passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make hours in the year a constant

1 participant